import request from '@/utils/request'

const order = {
  getPurchaseOrderInfo: function (orderNo) {
    return request({
      url: '/eims/purchase/order/detail/' + orderNo,
      method: 'get'
    })
  },
  getOrderListAPI: function (params) {
    return request({
      url: '/eims/purchase/order/list',
      method: 'post',
      data: params
    })
  },
  addOrderAPI: function (params) {
    return request({
      url: '/eims/purchase/order/add',
      method: 'post',
      data: params
    })
  },
  updateOrderAPI: function (params) {
    return request({
      url: '/eims/purchase/order/update/' + params.purchaseNo,
      method: 'put',
      data: params
    })
  },
  cancelOrderAPI: function (params) {
    return request({
      url: '/eims/purchase/order/cancel/' + params.purchaseNo,
      method: 'put',
      params: params
    })
  },
  submitOrderAPI: function (purchaseNo) {
    return request({
      url: '/eims/purchase/order/submit/' + purchaseNo,
      method: 'put'
    })
  },
  completedOrderAPI: function (purchaseNo) {
    return request({
      url: '/eims/purchase/order/completed/' + purchaseNo,
      method: 'put'
    })
  },
  rejectOrderAPI: function (purchaseNo) {
    return request({
      url: '/eims/purchase/order/reject/' + purchaseNo,
      method: 'put'
    })
  },
  deleteOrderAPI: function (id) {
    return request({
      url: '/eims/purchase/order/delete/' + id,
      method: 'delete'
    })
  },
  addOrderProductAPI: function (params) {
    return request({
      url: '/eims/purchase/order/detail/add/' + params.purchaseNo,
      method: 'post',
      data: params
    })
  },
  getOrderStockInfoListAPI: function (purchaseNo) {
    return request({
      url: '/eims/purchase/order/stock/list/' + purchaseNo,
      method: 'get'
    })
  },
  getOrderProductListAPI: function (purchaseNo) {
    return request({
      url: '/eims/purchase/order/detail/list/' + purchaseNo,
      method: 'get'
    })
  },
  deleteOrderProductAPI: function (params) {
    return request({
      url: '/eims/purchase/order/detail/delete/' + params.purchaseNo + '/' + params.purchaseDetailNo,
      method: 'delete'
    })
  }
}

export default order
